<template>
	<Table 
	:loading="loading" 
	stripe :columns="columns1" 
	:data="data1"
	:row-class-name="timealert"
	></Table>
</template>

<script>
	export default {
		props: {
			datas:Array
		},
		data() {
			return {
				loading:true,
				columns1: [{
						title: '作物名称',
						key: 'zname'
					},
					{
						title: '库存量',
						key: 'znv'
					},
					{
						title: '批次',
						key: 'intime'
					},
					{
						title: '过期时间',
						key: 'endtime'
					}
				],
				data1: []
			}
		},
		watch:{
			datas:{
				handler:function(nd){
					this.data1=nd
					this.loading=false
				}
			}
		},
		methods:{
			timealert(value){
				if(value.endtime){
					var t=new Date(value.endtime).getTime()
					var tnow=(new Date()).getTime()
					if(t<=tnow){
						return 'demo-table-error-row';
					}
					else{
						return ""
					}
				}
				return ""

			}
		}
	}
</script>

<style>
.ivu-table .demo-table-error-row td{
        /* background-color: #ff6600; */
        color:#ff6600;
    }
</style>
